package com.niuwa.p2p.service.impl.fund;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.niuwa.p2p.core.mvc.entity.PageBean;
import com.niuwa.p2p.dao.fund.AccountFlowDao;
import com.niuwa.p2p.entity.PageQuery;
import com.niuwa.p2p.entity.fund.AccountFlow;
import com.niuwa.p2p.service.fund.IAccountFlowManagerService;

@Service
public class AccountFlowServiceImpl  implements IAccountFlowManagerService{
    
	@Autowired
	AccountFlowDao  accountFlowDao;
	
	
	/**
	 * 
	 * 分页查询牛娃账户流水
	 * paramMap 查询参数
	 */
	@Override
	public PageBean<AccountFlow> searchNwAccountFlow(Map<String, Object> paramMap) {
		assert paramMap.get(PageQuery.PAGEQUERY) != null;
		//总条数
		int totalCount = accountFlowDao.getNwAccountFlowCountByCondition(paramMap);
		PageBean<AccountFlow> page = new PageBean<AccountFlow>(totalCount);
		// 当前页
		page.setPage(((PageQuery) paramMap.get(PageQuery.PAGEQUERY)).getPage());
		page.setRows(accountFlowDao.getNwAccountFlowByCondition(paramMap));
		return page;
	}

	public AccountFlowDao getAccountFlowDao() {
		return accountFlowDao;
	}
	public void setAccountFlowDao(AccountFlowDao accountFlowDao) {
		this.accountFlowDao = accountFlowDao;
	}

	@Override
	public PageBean<AccountFlow> searchBankrollRecord(
			Map<String, Object> paramMap) {
		assert paramMap.get(PageQuery.PAGEQUERY) != null;
		//总条数
		int totalCount = accountFlowDao.getAccountFundRecordCountByCondition(paramMap);
		PageBean<AccountFlow> page = new PageBean<AccountFlow>(totalCount);
		// 当前页
		page.setPage(((PageQuery) paramMap.get(PageQuery.PAGEQUERY)).getPage());
		page.setRows(accountFlowDao.searchAccountFundRecordByCondition(paramMap));
		return page;
	}

	
	/**
	 *通过条件查询牛娃资金流水条数【web】
	 * @param paramMap
	 * @returnInteger
	 *
	 */
	@Override
	public List<AccountFlow> getNwAccountFlowByConditionListPage(
			Map<String, Object> paramMap) {
		return accountFlowDao.getNwAccountFlowByConditionListPage(paramMap);
	}

	@Override
	public AccountFlow selectAccountFlowDetail(Map<String,Object> paramMap){
		return accountFlowDao.selectAccountFlowDetail(paramMap);
	}

	@Override
	public Long getIntervalTimerAmountByCondition(Map<String, Object> paramMap) {
		return accountFlowDao.getIntervalTimerAmountByCondition(paramMap);
	}
}
